package com.zretc.emptraining.serviceimpl;

import java.util.List;

import com.zretc.emptraining.dao.UsersDao;
import com.zretc.emptraining.daoimpl.UsersDaoImpl;
import com.zretc.emptraining.dbtools.PageData;
import com.zretc.emptraining.entity.Users;
import com.zretc.emptraining.service.UsersService;

public class UsersServiceImp implements UsersService{
	UsersDao usersDao = new UsersDaoImpl();
	@Override
	public boolean doLogin(String userName, String userPwd) {
		
		return usersDao.doLogin(userName, userPwd);
	}
	@Override
	public boolean addUsers(Users users) {
		if (users == null) {
			return false;
		}
		return usersDao.addUsers(users);
	}
	@Override
	public boolean stateUpd(String state, String userNo) {
		
		return usersDao.stateUpd(state, userNo);
	}
	@Override
	public boolean updUsersByName(int empNo, String userName, String userPwd, String userNo) {
		// TODO Auto-generated method stub
		return usersDao.updUsersByName(empNo, userName, userPwd, userNo);
	}
	@Override
	public PageData<Users> getUsersByPage(int page, int pageSize, String keywords) {
		// TODO Auto-generated method stub
		if (page<1) {
			page = 1;
		}
		return usersDao.getUserByPage(page, pageSize, keywords);
	}

	@Override
	public List<Users> getUsers(String keywords) {
		if(keywords != null) {
			return usersDao.getUsers(keywords);
		}
		return null;
	}

	@Override
	public Users getUserByName(String userName) {
		// TODO Auto-generated method stub
		return (Users) usersDao.getUsersByName(userName);
	}
	
	@Override
	public boolean initUserPwd(String userNo) {
		// TODO Auto-generated method stub
		return usersDao.initUserPwd(userNo);
	}
	
	@Override
	public boolean updUserNo(int empNo, String empTel) {
		// TODO Auto-generated method stub
		return usersDao.updUserNo(empNo, empTel);
	}
	
	@Override
	public boolean updUserPwd(String userNo, String userPwd) {
		// TODO Auto-generated method stub
		return usersDao.updUserPwd(userNo, userPwd);
	}
	
	@Override
	public Users getUserByPwd(String pwd) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public boolean updPwd(String userNo, String userPwd) {
		// TODO Auto-generated method stub
		return usersDao.updPwd(userNo, userPwd);
	}
	@Override
	public Users getUsersEmpNo(String userName) {
		// TODO Auto-generated method stub
		return usersDao.getUsersEmpNo(userName);
	}
	
	@Override
	public List<Users> getUsersByName(String userName) {
		// TODO Auto-generated method stub
		return usersDao.getUsersByName(userName);
	}
}
